package top.lyc829.mymusic.ui.fragment.login

import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.SavedStateHandle
import androidx.navigation.fragment.findNavController
import top.lyc829.mymusic.R
import top.lyc829.mymusic.base.BaseFragment
import top.lyc829.mymusic.databinding.FragmentLoginBinding
import top.lyc829.mymusic.ext.showToast

class LoginFragment : BaseFragment<LoginViewModel, FragmentLoginBinding>() {

    private lateinit var savedStateHandle: SavedStateHandle

    companion object {
        fun newInstance() = LoginFragment()
        const val LOGIN_SUCCESSFUL: String = "LOGIN_SUCCESSFUL"
    }

    override fun getViewModel() = ViewModelProvider(this).get(LoginViewModel::class.java)
    override fun getBinding(inflater: LayoutInflater) = FragmentLoginBinding.inflate(inflater)

    override fun initView(savedInstanceState: Bundle?) {

    }

    override fun initClickListener() {
        binding.loginPhone.setOnClickListener {
            if (!binding.cbRole.isChecked) {
                showToast("请勾选协议")
            } else{
                findNavController().navigate(R.id.action_loginFragment_to_phoneLoginFragment)
            }
        }
    }

    override fun createObserver() {
    }

    override fun initData() {
    }


}